Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
13 | Analysis.prototype._analyzed = function(userData){ |
||
14 | var analyzedData = {}; |
||
15 | var loggedInTime = userData.loggedIn; |
||
16 | var lastActivity = userData.activities[userData.activities.length-1].ut; |
||
17 | analyzedData.timeSpent = lastActivity - loggedInTime; |
||
18 | var frequentArr = this.getFrequentText(userData.activities); |
||
19 | frequentArr.forEach(function(obj){ |
||
20 | if(obj.type == "question"){ |
||
21 | analyzedData.frequentBotText = obj.text; |
||
22 | } |
||
23 | if(obj.type == "command"){ |
||
24 | analyzedData.frequentUserText = obj.text; |
||
25 | } |
||
26 | }); |
||
27 | return analyzedData; |
||
28 | }; |
||
29 | |||
58 | module.exports = Analysis; |
When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically: